package cn.kw0501.tms.controller;


import cn.kw0501.tms.service.SmsService;
import cn.kw0501.tms.utils.JsonResult;
import cn.kw0501.tms.utils.ParmUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 系统_短信 前端控制器
 * </p>
 *
 * @author Aedes
 * @since 2022-11-18
 */
@RestController
@RequestMapping("/sms")
public class SmsController {
    @Autowired
    SmsService smsService;

    @PostMapping("/send")
    public JsonResult sendSms(@RequestParam Map<String,Object> paramMap){
        String [] pa = {"phone"};
        String key = ParmUtil.checkParms(pa,paramMap);
        if(key!=null){
            return JsonResult.err(1001,key+"未传递");
        }
        return smsService.sendSms(paramMap.get("phone").toString());
    }

}

